<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.2.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
  <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"danieltyl.gitee.io","root":"/","scheme":"Pisces","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":true,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":true},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":true,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
  </script>

  <meta name="description" content="通过 Hexo 可以快速搭建自己的个人静态博客 通过 Github Pages 功能能够成功部署，这也是大多数人选择的搭配方案，但是Github在国内的访问速度有时实在让人难以忍受，因此 Gitee Pages 成为了很好的替代。作为初学者，本篇文章记录了 Hexo 搭配 Gitee 完成个人博客的搭建过程。">
<meta property="og:type" content="article">
<meta property="og:title" content="Hexo+Gitee搭建静态博客">
<meta property="og:url" content="https://danieltyl.gitee.io/2020/04/09/Hexo-Gitee%E6%90%AD%E5%BB%BA%E9%9D%99%E6%80%81%E5%8D%9A%E5%AE%A2/index.html">
<meta property="og:site_name" content="DanielTANG">
<meta property="og:description" content="通过 Hexo 可以快速搭建自己的个人静态博客 通过 Github Pages 功能能够成功部署，这也是大多数人选择的搭配方案，但是Github在国内的访问速度有时实在让人难以忍受，因此 Gitee Pages 成为了很好的替代。作为初学者，本篇文章记录了 Hexo 搭配 Gitee 完成个人博客的搭建过程。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gitee.com/danieltyl/ImageBed/raw/master/%E5%B0%8F%E4%B9%A6%E5%8C%A0/GiteePages.jpg">
<meta property="og:image" content="https://gitee.com/danieltyl/ImageBed/raw/master/%E5%B0%8F%E4%B9%A6%E5%8C%A0/GiteePages2.jpg">
<meta property="og:image" content="https://gitee.com/danieltyl/ImageBed/raw/master/%E5%B0%8F%E4%B9%A6%E5%8C%A0/config1.jpg">
<meta property="og:image" content="https://gitee.com/danieltyl/ImageBed/raw/master/%E5%B0%8F%E4%B9%A6%E5%8C%A0/url.jpg">
<meta property="og:image" content="https://gitee.com/danieltyl/ImageBed/raw/master/%E5%B0%8F%E4%B9%A6%E5%8C%A0/comment1.jpg">
<meta property="og:image" content="https://gitee.com/danieltyl/ImageBed/raw/master/%E5%B0%8F%E4%B9%A6%E5%8C%A0/comment2.jpg">
<meta property="article:published_time" content="2020-04-09T09:44:03.000Z">
<meta property="article:modified_time" content="2020-04-09T09:46:15.104Z">
<meta property="article:author" content="TYL">
<meta property="article:tag" content="Hexo">
<meta property="article:tag" content="Gitee">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/danieltyl/ImageBed/raw/master/%E5%B0%8F%E4%B9%A6%E5%8C%A0/GiteePages.jpg">

<link rel="canonical" href="https://danieltyl.gitee.io/2020/04/09/Hexo-Gitee%E6%90%AD%E5%BB%BA%E9%9D%99%E6%80%81%E5%8D%9A%E5%AE%A2/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>Hexo+Gitee搭建静态博客 | DanielTANG</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">DanielTANG</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">尽人事，知天命</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-about">

    <a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
        <div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div id="search-result">
  <div id="no-result">
    <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
  </div>
</div>

    </div>
  </div>

</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

  <a href="https://github.com/Tacode" class="github-corner" title="Follow me on GitHub" aria-label="Follow me on GitHub" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://danieltyl.gitee.io/2020/04/09/Hexo-Gitee%E6%90%AD%E5%BB%BA%E9%9D%99%E6%80%81%E5%8D%9A%E5%AE%A2/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/image.png">
      <meta itemprop="name" content="TYL">
      <meta itemprop="description" content="A Coder">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="DanielTANG">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Hexo+Gitee搭建静态博客
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              

              <time title="创建时间：2020-04-09 17:44:03 / 修改时间：17:46:15" itemprop="dateCreated datePublished" datetime="2020-04-09T17:44:03+08:00">2020-04-09</time>
            </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/%E6%9D%82%E9%A1%B9/" itemprop="url" rel="index"><span itemprop="name">杂项</span></a>
                </span>
            </span>

          
            <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
              <span class="post-meta-item-icon">
                <i class="fa fa-eye"></i>
              </span>
              <span class="post-meta-item-text">阅读次数：</span>
              <span id="busuanzi_value_page_pv"></span>
            </span>
  
  <span class="post-meta-item">
    
      <span class="post-meta-item-icon">
        <i class="far fa-comment"></i>
      </span>
      <span class="post-meta-item-text">Valine：</span>
    
    <a title="valine" href="/2020/04/09/Hexo-Gitee%E6%90%AD%E5%BB%BA%E9%9D%99%E6%80%81%E5%8D%9A%E5%AE%A2/#valine-comments" itemprop="discussionUrl">
      <span class="post-comments-count valine-comment-count" data-xid="/2020/04/09/Hexo-Gitee%E6%90%AD%E5%BB%BA%E9%9D%99%E6%80%81%E5%8D%9A%E5%AE%A2/" itemprop="commentCount"></span>
    </a>
  </span>
  
  <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="far fa-file-word"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>4.2k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="far fa-clock"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>4 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <p>通过 <code>Hexo</code> 可以快速搭建自己的个人静态博客 通过 <code>Github Pages</code> 功能能够成功部署，这也是大多数人选择的搭配方案，但是Github在国内的访问速度有时实在让人难以忍受，因此 <code>Gitee Pages</code> 成为了很好的替代。作为初学者，本篇文章记录了 <code>Hexo</code> 搭配 <code>Gitee</code> 完成个人博客的搭建过程。</p>
<a id="more"></a>
<h3 id="1-下载安装必要组件"><a href="#1-下载安装必要组件" class="headerlink" title="1.下载安装必要组件"></a>1.下载安装必要组件</h3><ol>
<li><a href="https://git-scm.com/download/win" target="_blank" rel="noopener">git下载安装</a></li>
<li><a href="https://nodejs.org/en/download/" target="_blank" rel="noopener">Node.js下载安装</a></li>
<li>安装完Node.js,配置环境变量，在存放Hexo的文件下，通过命令行输入命令： <figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">$</span><span class="bash"> npm install -g hexo-cli</span></span><br></pre></td></tr></table></figure>
<h3 id="2-Gitee端配置"><a href="#2-Gitee端配置" class="headerlink" title="2.Gitee端配置"></a>2.Gitee端配置</h3></li>
<li><code>Gitee</code> 方面首先要注册一个Gitee账号，新建 <code>Gitee</code> 仓库用于存放部署文件以便于生成 <code>Page</code>,仓库名建议使用Gitee用户名，这样就能产生 <code>https://xxxx.gitee.io</code>的域名</li>
<li>通过命令生成Git公钥, <figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">$</span><span class="bash"> ssh-keygen -o</span></span><br></pre></td></tr></table></figure></li>
<li>在 <code>Gitee</code> 的设置-&gt;安全设置-&gt;SSH公钥，添加刚才生成的公钥</li>
</ol>
<h3 id="3-Hexo部署配置"><a href="#3-Hexo部署配置" class="headerlink" title="3.Hexo部署配置"></a>3.Hexo部署配置</h3><ol>
<li>初始化博客 <figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">$</span><span class="bash"> hexo init blog</span></span><br></pre></td></tr></table></figure></li>
<li>修改站点配置文件<code>_comfig.yml</code> 中的部署信息,关联之前的仓库 <figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">deploy:</span></span><br><span class="line">    <span class="attr">type:</span> <span class="string">git</span></span><br><span class="line">    <span class="attr">repo:</span> <span class="string">git@gitee.com:xxxx/xxxxx.git</span></span><br><span class="line">    <span class="attr">branch:</span> <span class="string">master</span></span><br></pre></td></tr></table></figure></li>
<li>安装部署命令 <figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">$</span><span class="bash"> npm install hexo-deployer-git --save</span></span><br></pre></td></tr></table></figure></li>
<li>输入命令部署 <figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">$</span><span class="bash"> hexo clean</span></span><br><span class="line"><span class="meta">$</span><span class="bash"> hexo d -g</span></span><br></pre></td></tr></table></figure>
当然部署前也可以进行本地预览，通过<code>hexo s</code>命令，然后在浏览器中输入<code>localhost:4000</code>可以预览。至此,基本的 <code>Hexo</code> 博客网页文件能够上传到 <code>Gitee</code> 上, 生成最后的网页还需将仓库的文件生成 <code>Gitee Pages</code>。<br><img src="https://gitee.com/danieltyl/ImageBed/raw/master/%E5%B0%8F%E4%B9%A6%E5%8C%A0/GiteePages.jpg" alt="enter description here"><br>免费的<code>Gitee Pages</code>服务一般需要手动部署, 完成部署就会得到一个网站地址，该地址打开就是个人博客网站。<br><img src="https://gitee.com/danieltyl/ImageBed/raw/master/%E5%B0%8F%E4%B9%A6%E5%8C%A0/GiteePages2.jpg" alt="enter description here"><br>这样一开始部署的是 <code>Hexo</code> 默认的主题，原生态，啥都没修改。</li>
</ol>
<p><strong>tips: Hexo相关命令</strong></p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">$</span><span class="bash"> hexo clean             <span class="comment">#清除</span></span></span><br><span class="line"><span class="meta">$</span><span class="bash"> hexo g                 <span class="comment">#生成</span></span></span><br><span class="line"><span class="meta">$</span><span class="bash"> hexo s                 <span class="comment">#本地预览</span></span></span><br><span class="line"><span class="meta">$</span><span class="bash"> hexo d                 <span class="comment">#部署</span></span></span><br><span class="line"><span class="meta">$</span><span class="bash"> hexo n &lt;title&gt;         <span class="comment">#新建一个提交的文档</span></span></span><br><span class="line"><span class="meta">$</span><span class="bash"> hexo new draft &lt;title&gt; <span class="comment">#新建一个草稿</span></span></span><br><span class="line"><span class="meta">$</span><span class="bash"> hexo s --draft         <span class="comment">#预览草稿</span></span></span><br><span class="line"><span class="meta">$</span><span class="bash"> hexo P &lt;filename&gt;      <span class="comment">#将草稿转为正式提交文件</span></span></span><br></pre></td></tr></table></figure>
<h3 id="4-NexT主题安装配置"><a href="#4-NexT主题安装配置" class="headerlink" title="4.NexT主题安装配置"></a>4.NexT主题安装配置</h3><p><code>Hexo</code>提供了很多主题，但是经典的还是简洁的 <code>NexT</code> 主题。首先需要下载主题，在之前初始化的 <code>blog</code> 文件下运行：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">$</span><span class="bash"> git <span class="built_in">clone</span> https://github.com/theme-next/hexo-theme-next themes/next</span></span><br></pre></td></tr></table></figure>
<p>修改站点配置文件<code>_comfig.yml</code>中的 <code>theme</code> 项为 <code>next</code> ，再次部署就可以让个人博客使用<code>NexT</code> 主题。但为了让博客简洁而美观，还有许多自定义配置需要操作。</p>
<h5 id="1-语言以及标题子标题修改"><a href="#1-语言以及标题子标题修改" class="headerlink" title="1. 语言以及标题子标题修改"></a>1. 语言以及标题子标题修改</h5><p>为了博客使用中文界面，修改站点配置文件：<br><img src="https://gitee.com/danieltyl/ImageBed/raw/master/%E5%B0%8F%E4%B9%A6%E5%8C%A0/config1.jpg" alt="enter description here"><br>依次为: 标题，子标题，描述，关键字 作者名，语言，时区<br>需要注意的是语言 <code>zh-CN</code> 要保持和 <code>theme/next/languages/</code> 中的文件名保持一致</p>
<h5 id="2-菜单栏的设置"><a href="#2-菜单栏的设置" class="headerlink" title="2. 菜单栏的设置"></a>2. 菜单栏的设置</h5><figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">menu:</span></span><br><span class="line">  <span class="attr">home:</span> <span class="string">/</span> <span class="string">||</span> <span class="string">fa</span> <span class="string">fa-home</span></span><br><span class="line">  <span class="attr">about:</span> <span class="string">/about/</span> <span class="string">||</span> <span class="string">fa</span> <span class="string">fa-user</span></span><br><span class="line">  <span class="attr">tags:</span> <span class="string">/tags/</span> <span class="string">||</span> <span class="string">fa</span> <span class="string">fa-tags</span></span><br><span class="line">  <span class="attr">categories:</span> <span class="string">/categories/</span> <span class="string">||</span> <span class="string">fa</span> <span class="string">fa-th</span></span><br><span class="line">  <span class="attr">archives:</span> <span class="string">/archives/</span> <span class="string">||</span> <span class="string">fa</span> <span class="string">fa-archive</span></span><br><span class="line">  <span class="comment">#schedule: /schedule/ || fa fa-calendar</span></span><br><span class="line">  <span class="comment">#sitemap: /sitemap.xml || fa fa-sitemap</span></span><br><span class="line">  <span class="comment">#commonweal: /404/ || fa fa-heartbeat</span></span><br></pre></td></tr></table></figure>
<p>为了让 <code>tags</code> 和 <code>categories</code> 起作用，需要简单设置一下，在命令行中输入:</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">$</span><span class="bash"> hexo new page <span class="string">"tags"</span></span></span><br></pre></td></tr></table></figure>
<p>此时会在 <code>Hexo</code> 更目录的 <code>Source</code> 文件夹生成 <code>tags/index.md</code>，修改这个文件</p>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: tags</span><br><span class="line">date: 2020-04-06 22:56:03</span><br><span class="line">type: "tags"</span><br><span class="line">---</span><br></pre></td></tr></table></figure>
<p>而 <code>categories</code> 是类似操作,不再赘述。另外为了新建的文档能够自动带上<br><code>tags</code> 和 <code>categories</code> 前缀，需要修改根目录下的 <code>scaffolds</code> 文件夹下的 markdown 文件</p>
<figure class="highlight markdown"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: &#123;&#123; title &#125;&#125;</span><br><span class="line">date: &#123;&#123; date &#125;&#125;</span><br><span class="line">tags:</span><br><span class="line">categories:</span><br><span class="line">---</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="xml"><span class="comment">&lt;!-- more --&gt;</span></span></span><br></pre></td></tr></table></figure>
<p><code>&lt;!-- more --&gt;</code> 以上的内容在博客中首页预览，而轴的内容将隐藏，在博客中点击阅读全文可以展开</p>
<h5 id="3-头像的设置"><a href="#3-头像的设置" class="headerlink" title="3. 头像的设置"></a>3. 头像的设置</h5><p>头像设置非常简单，在 <code>NexT</code> 主题配置文件中修改 <code>avatar</code> 的 <code>url</code>，可以是网上的图片，也可以是本地存储图片。本地存储图片最后放在<code>NexT</code> 主题文件 <code>source/images</code> 下</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">avatar:</span></span><br><span class="line">  <span class="comment"># Replace the default image and set the url here.</span></span><br><span class="line">  <span class="attr">url:</span> <span class="string">/images/image.png</span></span><br><span class="line">  <span class="comment"># If true, the avatar will be dispalyed in circle.</span></span><br><span class="line">  <span class="attr">rounded:</span> <span class="literal">false</span></span><br><span class="line">  <span class="comment"># If true, the avatar will be rotated with the cursor.</span></span><br><span class="line">  <span class="attr">rotated:</span> <span class="literal">false</span></span><br></pre></td></tr></table></figure>

<h5 id="4-文章浏览量和站点浏览量设置"><a href="#4-文章浏览量和站点浏览量设置" class="headerlink" title="4. 文章浏览量和站点浏览量设置"></a>4. 文章浏览量和站点浏览量设置</h5><p>打开 <code>themes/next/</code> 下的 <code>_config.yml</code> ，查找 <code>busuanzi</code>, 完成配置，就能得到以图标显示的浏览统计信息</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">busuanzi_count:</span></span><br><span class="line">  <span class="attr">enable:</span> <span class="literal">true</span></span><br><span class="line">  <span class="attr">total_visitors:</span> <span class="literal">true</span></span><br><span class="line">  <span class="attr">total_visitors_icon:</span> <span class="string">fa</span> <span class="string">fa-user</span></span><br><span class="line">  <span class="attr">total_views:</span> <span class="literal">true</span></span><br><span class="line">  <span class="attr">total_views_icon:</span> <span class="string">fa</span> <span class="string">fa-eye</span></span><br><span class="line">  <span class="attr">post_views:</span> <span class="literal">true</span></span><br><span class="line">  <span class="attr">post_views_icon:</span> <span class="string">fa</span> <span class="string">fa-eye</span></span><br></pre></td></tr></table></figure>
<p>一般Hexo网页底部，也是站点浏览量那里了会有Hexo强力驱动之类的，可以将其删除<br>找到 \themes\next\layout_partials\下面的footer.swig文件，打开找到以下内容将其删除：</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"powered-by"</span>&gt;</span></span><br><span class="line">  &#123;&#123; __('footer.powered', '<span class="tag">&lt;<span class="name">a</span> <span class="attr">class</span>=<span class="string">"theme-link"</span> <span class="attr">href</span>=<span class="string">"https://hexo.io"</span>&gt;</span>Hexo<span class="tag">&lt;/<span class="name">a</span>&gt;</span>') &#125;&#125;</span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"theme-info"</span>&gt;</span></span><br><span class="line">  &#123;&#123; __('footer.theme') &#125;&#125; -</span><br><span class="line">  <span class="tag">&lt;<span class="name">a</span> <span class="attr">class</span>=<span class="string">"theme-link"</span> <span class="attr">href</span>=<span class="string">"https://github.com/iissnan/hexo-theme-next"</span>&gt;</span></span><br><span class="line">    NexT.&#123;&#123; theme.scheme &#125;&#125;</span><br><span class="line">  <span class="tag">&lt;/<span class="name">a</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br></pre></td></tr></table></figure>


<h5 id="5-文章字数和阅读时间统计设置"><a href="#5-文章字数和阅读时间统计设置" class="headerlink" title="5. 文章字数和阅读时间统计设置"></a>5. 文章字数和阅读时间统计设置</h5><p>统计字数以及统计阅读时间需要安装：</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">$</span><span class="bash"> npm install hexo-symbols-count-time --save</span></span><br></pre></td></tr></table></figure>
<p>在站点配置文件中添加以下内容：</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">symbols_count_time:</span></span><br><span class="line">  <span class="attr">symbols:</span> <span class="literal">true</span>                </span><br><span class="line">  <span class="attr">time:</span> <span class="literal">true</span>                   </span><br><span class="line">  <span class="attr">total_symbols:</span> <span class="literal">true</span>          </span><br><span class="line">  <span class="attr">total_time:</span> <span class="literal">true</span>             </span><br><span class="line">  <span class="attr">exclude_codeblock:</span> <span class="literal">false</span></span><br></pre></td></tr></table></figure>

<h5 id="6-版权声明设置"><a href="#6-版权声明设置" class="headerlink" title="6. 版权声明设置"></a>6. 版权声明设置</h5><p>新版的 <code>NexT</code> 设置版权声明十分简单，在主题配置文件中找到 <code>creative_commons</code> 设置为：</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">creative_commons:</span></span><br><span class="line">  <span class="attr">license:</span> <span class="string">by-nc-sa</span></span><br><span class="line">  <span class="attr">sidebar:</span> <span class="literal">false</span></span><br><span class="line">  <span class="attr">post:</span> <span class="literal">true</span></span><br><span class="line">  <span class="attr">language:</span> <span class="string">deed.zh</span></span><br></pre></td></tr></table></figure>
<p>注意的是，需要在站点配置文件中设置好自己的Url，不然生成的版权声明中的连接无法打开，Url设置为自己的博客域名<br><img src="https://gitee.com/danieltyl/ImageBed/raw/master/%E5%B0%8F%E4%B9%A6%E5%8C%A0/url.jpg" alt="enter description here"></p>
<h5 id="7-评论系统设置"><a href="#7-评论系统设置" class="headerlink" title="7. 评论系统设置"></a>7. 评论系统设置</h5><p>评论系统有很多，这里最好使用 <code>Valine</code>, <code>NexT</code>中有集成，为了使用评论系统，首先需要一个云服务，采用免费的 <a href="https://us.leancloud.cn/" target="_blank" rel="noopener">LeanCloud</a> 服务就可以, 完成账号注册之后 点击 <code>创建应用</code>，填写应用名称，选择开发版进行创建。<br><img src="https://gitee.com/danieltyl/ImageBed/raw/master/%E5%B0%8F%E4%B9%A6%E5%8C%A0/comment1.jpg" alt="enter description here"><br>创建完成之后，获取 <code>AppID</code> 和 <code>APPKey</code> ，这两个需要在 <code>Valine</code> 中使用。最后，记得在Leancloud -&gt; 设置 -&gt; 安全中心 -&gt; Web 安全域名 把你的域名加进去。<br><img src="https://gitee.com/danieltyl/ImageBed/raw/master/%E5%B0%8F%E4%B9%A6%E5%8C%A0/comment2.jpg" alt="enter description here"></p>
<p>配置主题配置文件，找到 <code>valine</code>, 将上面的<code>AppID</code> 和 <code>APPKey</code>填入对应位置:</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">valine:</span></span><br><span class="line">  <span class="attr">enable:</span> <span class="literal">true</span></span><br><span class="line">  <span class="attr">appid:</span> <span class="string">&lt;AppID&gt;</span> </span><br><span class="line">  <span class="attr">appkey:</span> <span class="string">&lt;AppKey&gt;</span></span><br><span class="line">  <span class="attr">notify:</span> <span class="literal">false</span> <span class="comment"># Mail notifier</span></span><br><span class="line">  <span class="attr">verify:</span> <span class="literal">false</span> <span class="comment"># Verification code</span></span><br><span class="line">  <span class="attr">placeholder:</span> <span class="string">快来评论一个吧~~（建议在上方留下昵称和邮箱）</span> <span class="comment"># Comment box placeholder</span></span><br><span class="line">  <span class="attr">avatar:</span> <span class="string">mm</span> <span class="comment"># Gravatar style</span></span><br><span class="line">  <span class="attr">guest_info:</span> <span class="string">nick,mail,link</span> <span class="comment"># Custom comment header</span></span><br><span class="line">  <span class="attr">pageSize:</span> <span class="number">10</span> <span class="comment"># Pagination size</span></span><br><span class="line">  <span class="attr">language:</span> <span class="comment"># Language, available values: en, zh-cn</span></span><br><span class="line">  <span class="attr">visitor:</span> <span class="literal">false</span> <span class="comment"># Article reading statistic</span></span><br><span class="line">  <span class="attr">comment_count:</span> <span class="literal">true</span> <span class="comment"># If false, comment count will only be displayed in post page, not in home page</span></span><br><span class="line">  <span class="attr">recordIP:</span> <span class="literal">false</span> <span class="comment"># Whether to record the commenter IP</span></span><br><span class="line">  <span class="attr">serverURLs:</span> <span class="comment"># When the custom domain name is enabled, fill it in here (it will be detected automatically by default, no need to fill in)</span></span><br><span class="line">  <span class="comment">#post_meta_order: 0</span></span><br></pre></td></tr></table></figure>

<p>目前，作为初学者学习博客搭建，就做了这些，以此记录。</p>

    </div>

    
    
    
        

<div>
<ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者： </strong>TYL
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="https://danieltyl.gitee.io/2020/04/09/Hexo-Gitee%E6%90%AD%E5%BB%BA%E9%9D%99%E6%80%81%E5%8D%9A%E5%AE%A2/" title="Hexo+Gitee搭建静态博客">https://danieltyl.gitee.io/2020/04/09/Hexo-Gitee搭建静态博客/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" rel="noopener" target="_blank"><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！
  </li>
</ul>
</div>


      <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/Hexo/" rel="tag"># Hexo</a>
              <a href="/tags/Gitee/" rel="tag"># Gitee</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/2020/04/06/JDBC%E5%AD%A6%E4%B9%A0%EF%BC%88%E4%BA%8C%EF%BC%89%E6%95%B0%E6%8D%AE%E5%BA%93%E6%93%8D%E4%BD%9C/" rel="prev" title="JDBC学习（二）数据库操作">
      <i class="fa fa-chevron-left"></i> JDBC学习（二）数据库操作
    </a></div>
      <div class="post-nav-item">
    <a href="/2020/04/10/Spring%E5%AD%A6%E4%B9%A0-%E4%B8%80-IOC%E4%B9%8BBean%E7%9A%84Xml%E9%85%8D%E7%BD%AE/" rel="next" title="Spring学习(一) IOC之Bean的xml配置">
      Spring学习(一) IOC之Bean的xml配置 <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          
    <div class="comments" id="valine-comments"></div>

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-下载安装必要组件"><span class="nav-text">1.下载安装必要组件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-Gitee端配置"><span class="nav-text">2.Gitee端配置</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-Hexo部署配置"><span class="nav-text">3.Hexo部署配置</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#4-NexT主题安装配置"><span class="nav-text">4.NexT主题安装配置</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#1-语言以及标题子标题修改"><span class="nav-text">1. 语言以及标题子标题修改</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#2-菜单栏的设置"><span class="nav-text">2. 菜单栏的设置</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#3-头像的设置"><span class="nav-text">3. 头像的设置</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#4-文章浏览量和站点浏览量设置"><span class="nav-text">4. 文章浏览量和站点浏览量设置</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#5-文章字数和阅读时间统计设置"><span class="nav-text">5. 文章字数和阅读时间统计设置</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#6-版权声明设置"><span class="nav-text">6. 版权声明设置</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#7-评论系统设置"><span class="nav-text">7. 评论系统设置</span></a></li></ol></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="TYL"
      src="/images/image.png">
  <p class="site-author-name" itemprop="name">TYL</p>
  <div class="site-description" itemprop="description">A Coder</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">4</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">2</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">4</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/Tacode" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;Tacode" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:yuliangtang111@gmail.com" title="E-Mail → mailto:yuliangtang111@gmail.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
      </span>
  </div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">TYL</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-area"></i>
    </span>
    <span title="站点总字数">23k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">21 分钟</span>
</div>

        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
    <span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>








      </div>
    </footer>
  </div>

  
  <script src="/lib/anime.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
  <script src="//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>

<script src="/js/utils.js"></script>

<script src="/js/motion.js"></script>


<script src="/js/schemes/pisces.js"></script>


<script src="/js/next-boot.js"></script>




  




  
<script src="/js/local-search.js"></script>













  

  

   

<script>
NexT.utils.loadComments(document.querySelector('#valine-comments'), () => {
  NexT.utils.getScript('//unpkg.com/valine/dist/Valine.min.js', () => {
    var GUEST = ['nick', 'mail', 'link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item => {
      return GUEST.includes(item);
    });
    new Valine({
      el         : '#valine-comments',
      verify     : false,
      notify     : false,
      appId      : '8c6WWTgkj5WsmtOe9xjESn2J-gzGzoHsz',
      appKey     : 'wrAk5MOjgpbtEl3DOsTK4VE0',
      placeholder: "快来评论一个吧~~（建议在上方留下昵称和邮箱）",
      avatar     : 'mm',
      meta       : guest,
      pageSize   : '10' || 10,
      visitor    : false,
      lang       : '' || 'zh-cn',
      path       : location.pathname,
      recordIP   : false,
      serverURLs : ''
    });
  }, window.Valine);
});
</script>

</body>
</html>
